package java9;

import java.util.Arrays;
import java.util.Scanner;

public class Code117 {
	public static void main(String[] args) {
		String[] musics =new String[]{"Island","Ocean","Pretty","Sun"};
		String[] newmusics=new String[musics.length+1];
		for (int i = 0; i < musics.length; i++) {
			newmusics[i]=musics[i];
		}
		String music="Faded ";
		int dex = musics.length;
		Scanner input=new Scanner(System.in);
		System.out.print("\n请输入歌曲名称:");
		music=input.next();
		for (int i = 0; i < musics.length; i++) {
			if(musics[i].compareToIgnoreCase(music)>0){
				dex=i;
				break;
			}	
		}
		for(int i=musics.length;i>dex;i--){
			newmusics[i]=newmusics[i-1];
		}
		newmusics[dex]=music;
		System.out.println("插入前的数组"+Arrays.toString(musics));
		System.out.println("插入后的数组"+Arrays.toString(newmusics));
	}
}

